<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/head::commonHeaderList('学员课程评价列表')">

</head>
<body>
<div id="content" class="col-lg-12 col-sm-12">
    <div class="row">
        <div class="box col-md-12" style="padding: 0;margin-top: 5px;">
            <div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2>
                        <i class="glyphicon glyphicon-list"></i> <span th:text="${param.loginName}"></span>学员课程评价列表
                    </h2>
                    <div class="box-icon">
                        <a href="javascript:void(0);" id="smaller" class="btn btn-minimize btn-round btn-default"><i class="glyphicon glyphicon-chevron-up"></i></a>
                    </div>
                </div>
                <div class="box-content">
                    <form class="form-inline form-search" role="form" method="post" th:action="@{/lesson/student/evaluation/list}">
                        <div class="form-group" data-chosenWidth="true"  style="margin-bottom: 5px;">
                            <select name="pageSize" class="form-control input-sm" id="pagesize">
                                <option value="10" th:selected="${pageSize==10}">10条/页</option>
                                <option value="25" th:selected="${pageSize==25}">25条/页</option>
                                <option value="50" th:selected="${pageSize==50}">50条/页</option>
                            </select>
                            <select class="selectpicker" name="listCcId" th:if="${session.roleId!=2}" multiple data-live-search="true" th:title="请选择CC" data-live-search-placeholder="搜索" data-actions-box="true">
                                <optgroup th:each="item:${cclist}" th:label="${item.name}">
                                    <option th:each="oitem:${item.list}" th:value="${oitem.id}" th:selected="${oitem.selected}" th:text="${oitem.name}"></option>
                                </optgroup>
                            </select>
                            <select class="selectpicker" name="listSscId" th:if="${session.roleId!=2 && session.roleId!=12 && session.roleId!=8}" multiple data-live-search="true" th:title="请选择SSC" data-live-search-placeholder="搜索" data-actions-box="true">
                                <option th:each="item:${ssclist}" th:value="${item.id}" th:selected="${item.selected}" th:text="${item.loginName}"></option>
                            </select>
                            <select name="stars" class="form-control input-sm" id="starNum">
                                <option value="">----select stars----</option>
                                <option th:each="item:${#numbers.sequence(1,5)}" th:value="${item}" th:selected="${item==stars}" th:text="${item + 'Star'}">Star</option>
                                <option value="6" th:selected="${stars==6}">≤ 3 Stars</option>
                                <option value="7" th:selected="${stars==7}">≥ 4 Stars</option>
                            </select>
                            <select name="commentStatus" class="form-control input-sm" id="commentStatus">
                                <option value="">----select Comment----</option>
                                <option value="0" th:selected="${commentStatus==0}">有评论内容</option>
                            </select>
                            <input name="startDate" id="startDate" class="form-control input-sm" maxlength="10" style="min-width:100px;" th:value="${startDate}" placeholder="课程开始日期" onfocus="WdatePicker()" autocomplete="off"/>
                            <input name="endDate" id="endDate" class="form-control input-sm" maxlength="10" style="min-width:100px;" th:value="${endDate}" placeholder="课程结束日期" onfocus="WdatePicker()" autocomplete="off"/>
                            <input name="createdDate" id="createdDate" class="form-control input-sm" maxlength="10" style="min-width:100px;" th:value="${createdDate}" placeholder="创建日期" onfocus="WdatePicker()" autocomplete="off"/>
                            <div class="input-group input-group-sm">
                                <input type="search" name="searchKey" id="search" class="form-control input-sm" th:value="${searchKey}" placeholder="查询关键字..." style="width:200px;"/>
                                <span class="input-group-btn">
                                    <button class="btn btn-primary" type="submit" > 查 询 </button>
                                </span>
                            </div>
                        </div>
                    </form>
                    <table class="table table-striped table-bordered table-hover footable" data-show-toggle="false">
                        <thead>
                        <tr>
                            <th class="text-center">#</th>
                            <th class="text-center">Student</th>
                            <th class="text-center">Name</th>
                            <th class="text-center">Teacher</th>
                            <th class="text-center">Class Time</th>
                            <th class="text-center" data-breakpoints="xs">SSC</th>
                            <th class="text-center" data-breakpoints="xs">CC</th>
                            <th class="text-center">Star</th>
                            <th class="text-center"  data-breakpoints="md">Tags & Comment</th>
                            <th class="text-center" data-breakpoints="xs">Create Time</th>
                            <th class="text-center">Feedback</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="item,itemStat:${pageInfo.list}">
                            <td class="text-center" th:text="${itemStat.index+1}"></td>
                            <td class="text-center"><a href="javascript:void(0)" th:text="${item.studentLogin}" th:onclick="|personInfo(${item.studentId})|"></a> </td>
                            <td class="text-center" style="white-space:nowrap;" th:text="${item.studentName}"></td>
                            <td class="text-center"><a href="javascript:void(0)" th:text="${item.teacherLogin}" th:onclick="|openWindow(this)|" th:data-url="@{'initEvaluate.action?teaRank.lessonId='+${item.lessonId}}"></a></td>
                            <td class="text-center" th:text="${#dates.format(item.classTime,'yyyy/MM/dd HH:mm')}"></td>
                            <td class="text-center" th:text="${item.sscLogin}"></td>
                            <td class="text-center" th:text="${item.ccLogin}"></td>
                            <td style="white-space:nowrap;">
                                <img alt="星" th:src="@{/static/img/raty/star_on.png}" th:each="item:${#numbers.sequence(1,item.stars)}">
                            </td>
                            <td th:with="listTagName=${#strings.listSplit(item.tagName,',')}">
                                <label class="label label-warning" style="margin-right:5px;white-space:nowrap;display:inline-block;" th:each="tagName:${listTagName}" th:text="${tagName}"></label><br>
                                <span th:text="${item.evaluation}"></span>
                            </td>
                            <td class="text-center" th:text="${#dates.format(item.createTime,'yyyy/MM/dd HH:mm:ss')}"></td>
                            <td>
                                <!--<button class='btn btn-primary btn-xs' href="#" rel="popover" id="reply${list.lessonId}" data-placement="left" onclick="addEvaluationReply(${list.lessonId})"> 回  复  </button>-->
                                <button class="btn btn-xs btn-danger" th:if="${item.evaluation!='' && item.stars==5 && item.show==1}" th:onclick="|showCloseEvaluation(${item.lessonId},0)|" style="margin-bottom:3px;">&nbsp;开启首页显示 &nbsp;</button>
                                <button class="btn btn-xs btn-default" th:if="${item.evaluation!='' && item.stars==5 && item.show==0}" th:onclick="|showCloseEvaluation(${item.lessonId},1)|" style="margin-bottom:3px;">&nbsp;关闭首页显示 &nbsp;</button>
                                <button th:if="${session.menuMap[149] != null}" class="btn btn-info btn-xs" th:onclick="|openWindow(this)|" th:data-url="@{'admin/lessons_searchETLessonInfoByLessonId.action?lessonId='+${item.lessonId}}" style="margin-bottom:3px;"> <i class="glyphicon glyphicon-zoom-in icon-white"></i> 上课日志</button>
<!--                                <button class='btn btn-primary btn-xs' href="#" rel="popover" id="reply${list.lessonId}" data-placement="left" onclick="addEvaluationReply(${list.lessonId})"> 录入结果 </button>-->
                                <button th:if="${session.menuMap[338] != null}" class="btn btn-primary btn-xs" th:id="'workflow'+${item.lessonId}" rel="popover" th:onclick="|workflowHtml(${item.lessonId})|" th:data-url="@{'/workflow/init/class/'+${item.lessonId}}" style="margin-bottom:3px;"> <i class="glyphicon glyphicon-edit icon-white"></i> 发起工作流</button>
                                <button th:if="${item.workflowIds!=null && item.workflowIds!=''}" class="btn btn-success btn-xs" th:id="'viewWorkflow'+${item.lessonId}" rel="popover" th:onclick="viewWorkflowHtml([[${item.workflowIds}]],[[${item.lessonId}]])" style="margin-bottom:3px;"> <i class="glyphicon glyphicon-zoom-in icon-white"></i> 查看工作流</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div th:include="include/pageinfo::pager"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include/onload_js::onloadJSCustomList(~{::script})">
    <script src="https://hkres.etalk365.com/public/lib/popper/1.15.0/umd/popper.min.js"></script>
    <script src="../../static/workflow/workflow_list.js" th:src="@{/static/workflow/workflow_list.js}"></script>
    <script src="../../static/js/openPerson.js" th:src="@{'/static/js/openPerson.js'}" ></script>
    <script>
        $(function() {
            $('.footable').footable();
        });
        //打开旧版页面的按钮
        function openWindow(obj) {
            let url="[[${session.oldCrmUrl}]]"+$(obj).data("url")+"&userToken=[[${session.userToken}]]";
            layer.open({
                type: 2,
                title: false,
                closeBtn: 1, //显示关闭按钮
                shade: [0],
                area: ['80%', '90%'],
                //offset: 'rb', //右下角弹出
                // time: 2000, //2秒后自动关闭
                anim: 2,
                content: [url, 'yes'], //iframe的url，no代表不显示滚动条
                end: function () {
                    //location.reload(true);
                }
            });
        }
        //是否在首页显示学员评价状态更新
        function showCloseEvaluation(lessonId,show) {
            let content = "";
            if (show === 0) {
                content = "确认开启评论首页显示吗？";
            } else {
                content = "确认关闭评论首页显示吗？";
            }
            layer.confirm(content, {
                btn: ['确定', '取消']//按钮
            }, function (index) {
                //此处请求后台程序，下方是成功后的前台处理……
                let url='/lesson/update/show/' + lessonId + '/' + show;
                $.post(url, {}, function (data) {
                    if (data.status > 0) {
                        layer.msg("更新成功");
                        setTimeout(function () {
                            location.reload(); //刷新父页面
                        }, 1500);
                    }
                });
            });
        }
    </script>

</div>
</body>
</html>